// pages/default/default.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    dotsFlag:true,
    msg:"欢迎！",
    bannerList:[
      {imgSrc:"../../images/banner01.jpg"},
      {imgSrc:"../../images/banner02.jpg"},
      {imgSrc:"../../images/banner03.jpg"}],
    grids:[
      {imgSrc:"/images/icon/jgch.jpg",title:"坚果炒货"},
      {imgSrc:"/images/icon/mjgg.jpg",title:"蜜饯果干"},
      {imgSrc:"/images/icon/phsp.jpg",title:"膨化食品"},
      {imgSrc:"/images/icon/rgss.jpg",title:"肉干熟食"},
    ],
    array: [{
      message: 'foo',
    }, {
      message: 'bar'
    }]
  },
  getCode(e){
    let code=e.currentTarget.dataset.code;
    console.log(code);
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    console.log("onLoad");
    var that=this
    //这里写服务器数据请求过程
    wx.request({
      url: 'http://kjxycode.zisu.edu.cn/InterfaceCommonForGoods/GetGoodsSalePromotionList',
      data:{token:"kjxy_Interface_2025"},
      method:"post",
      success:function(e){
        let result=e.data.goodsSalePromotionList;
        console.log(result)
        that.setData({bannerList:result});
      }
    })
    wx.request({
      url: 'http://kjxycode.zisu.edu.cn/InterfaceCommonForGoods/GetGoodsCateList',
      data:{token:"kjxy_Interface_2025"},
      method:"post",
      success:function(e){
        let result=e.data.cateList;
        that.setData({grids:result});
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {
    console.log("onReady");
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    console.log("onShow");
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {
    console.log("onHide");
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {
    console.log("onUnLoad");
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})